﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NLBS.Data;
using NLBS.Entity;
using NLBS.Control;

namespace NLBS.Admin.control
{
    public partial class wordFilter : BaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            checkAdmin();
            Repeater1.ItemDataBound += new RepeaterItemEventHandler(Repeater1_ItemDataBound);
            Repeater1.DataSource = DbProvider.Instance().GetWordFilter();
            Repeater1.DataBind();
        }

       

        void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                WordFilter wf = (WordFilter)e.Item.DataItem;
                HtmlInputCheckBox regexp = (HtmlInputCheckBox)e.Item.FindControl("regexp");
                HtmlSelect mode = (HtmlSelect)e.Item.FindControl("mode");
                regexp.Checked = wf.RegExp;
                mode.SelectedIndex = wf.Mode;
            }
        }
    }
}